/*
 * Copyright (c) 2006, 2023, webrx.cn All rights reserved.
 *
 */

package cn.webrx;

import java.io.File;

/**
 * <p>Project: jse2303 - Dir2
 * <p>Powered by webrx On 2023-07-20 17:41:21
 * <p>描述：<p>
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Dir2 {
    static int filecount = 0;
    static int rowscount = 0;

    public static void main(String[] args) {
        String path = "D:\\jdk\\jdk-17\\lib\\src";
        count(new File(path));
        //public 60000
        System.out.println(filecount);
        System.out.println(rowscount);

        
        //List<Map<String,Object>> list = new ArrayList<>();
        //Map<String,Object> map = new HashMap<String, Object>();
        //var set = new HashSet<String>();
    }

    public static void count(File dir) {
        File[] files = dir.listFiles();
        for (File file : files) {
            if (file.isDirectory()) {
                count(file);
            } else if (file.isFile() && file.getName().endsWith(".java")) {
                String p = file.getAbsolutePath();
                String t = String.format("%tF %<tT", file.lastModified());
                rowscount += FileUtil.getFileRow(p);
                ++filecount;
                //System.out.println(p + "[" + FileUtil.getFileRow(p) + "行 时间：" + t + "]");
            }
        }
    }
}
